<?php defined('SYSPATH') or die('No direct script access.');
/**
 * Security class.
 *
 * @package    Kohana
 * @category   Rules
 * @author     Kohana Team
 * @copyright  (c) 2007-2011 Kohana Team
 * @license    http://kohanaframework.org/license
 */
class Security extends Kohana_Security {

	public static function xss_clean(&$data, $fields = array())
	{
		if ( ! $fields && is_array($data)) $fields = array_keys($data);
		
		if (is_array($data))
		{
			foreach ($fields as $field)
			{
				if (isset($data[$field])) $data[$field] = htmlspecialchars($data[$field]);
			}
			return $data;
		}
		else
		{
			return htmlspecialchars($data);
		}
	}

} // End date
